import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/pay_list_entity.dart';

PayListEntity $PayListEntityFromJson(Map<String, dynamic> json) {
  final PayListEntity payListEntity = PayListEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    payListEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    payListEntity.msg = msg;
  }
  final List<PayListData>? data = (json['data'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<PayListData>(e) as PayListData).toList();
  if (data != null) {
    payListEntity.data = data;
  }
  return payListEntity;
}

Map<String, dynamic> $PayListEntityToJson(PayListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension PayListEntityExtension on PayListEntity {
  PayListEntity copyWith({
    int? code,
    String? msg,
    List<PayListData>? data,
  }) {
    return PayListEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

PayListData $PayListDataFromJson(Map<String, dynamic> json) {
  final PayListData payListData = PayListData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    payListData.id = id;
  }
  final int? userId = jsonConvert.convert<int>(json['user_id']);
  if (userId != null) {
    payListData.userId = userId;
  }
  final String? time = jsonConvert.convert<String>(json['time']);
  if (time != null) {
    payListData.time = time;
  }
  final String? amount = jsonConvert.convert<String>(json['amount']);
  if (amount != null) {
    payListData.amount = amount;
  }
  final String? way = jsonConvert.convert<String>(json['way']);
  if (way != null) {
    payListData.way = way;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    payListData.status = status;
  }
  return payListData;
}

Map<String, dynamic> $PayListDataToJson(PayListData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['user_id'] = entity.userId;
  data['time'] = entity.time;
  data['amount'] = entity.amount;
  data['way'] = entity.way;
  data['status'] = entity.status;
  return data;
}

extension PayListDataExtension on PayListData {
  PayListData copyWith({
    int? id,
    int? userId,
    String? time,
    String? amount,
    String? way,
    int? status,
  }) {
    return PayListData()
      ..id = id ?? this.id
      ..userId = userId ?? this.userId
      ..time = time ?? this.time
      ..amount = amount ?? this.amount
      ..way = way ?? this.way
      ..status = status ?? this.status;
  }
}